import { ref,reactive} from "vue";
import { defineStore } from "pinia";

export const useLoginStore = defineStore("loginId",()=>{
    //定义一个登录状态
    const loginBoolean = ref<boolean>(false)

    //定义一个用户信息
    const userInfo = reactive({
        user:"张三",
        password:"123456"
    })

    //根据输入的用户名和密码进行状态更新
    function login(params:any){
        if(params.user==userInfo.user && params.password == userInfo.password){
            loginBoolean.value=true
        }else{
            loginBoolean.value=false
        }
    }

    return{
        loginBoolean,
        userInfo,
        login
    }
})